package com.zhichat.web.controller;

import com.zhichat.service.ApplyInfoService;
import com.zhichat.web.api.PageUtils;
import com.zhichat.web.api.R;
import com.zhichat.web.dto.ApplyGeneDTO;
import com.zhichat.web.vo.ApplyInfoVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 联系人申请信息
 *
 * @Author: 团长九哥 https://space.bilibili.com/602197686
 * @CreateDate: 2024/11/17 21:46
 */
@Slf4j
@AllArgsConstructor
@RestController
@RequestMapping("/apply")
public class ApplyController {

    private final ApplyInfoService applyInfoService;

    /**
     * 申请信息 列表
     */
    @GetMapping("/list")
    public R<PageUtils<ApplyInfoVO>> applyList(@RequestParam("pageNumber") Integer pageNumber) {
        return R.success(applyInfoService.applyList(pageNumber));
    }

    /**
     * 处理 联系人（用户、群组）添加/入群 申请
     */
    @PostMapping("/dealApply")
    public R<String> dealApply(@RequestBody @Validated ApplyGeneDTO applyGeneDTO) {
        return R.status(applyInfoService.dealApply(applyGeneDTO));
    }
}
